package com.lmh.ymw.controller.product;

import com.lmh.ymw.entity.Product;
import com.lmh.ymw.entity.RespBean;
import com.lmh.ymw.service.product.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("Product")
@CrossOrigin
public class ProductController {
    @Autowired
    ProductService service;
    @GetMapping("list/{id}")
    public RespBean list(@PathVariable Integer id){
        List<Product> list = service.getProductByIdList(id);
        return RespBean.ok("成功",list);
    }
    @GetMapping("getId/{id}")
    public RespBean getId(@PathVariable Integer id){
        Product list = service.getProductById(id);
        return RespBean.ok("成功",list);
    }
}
